#ifndef TH_DATA_H
#define TH_DATA_H

#include <QtCore>

//温湿度设备(Temperature Humidity)
class CThData
{
public:
    bool IsCommNormal();
    bool IsCommFault();

    bool IsRunning();
    bool IsStopped();

    bool IsFault();
    bool IsNoFault();

    bool IsAlarm();
    bool IsNoAlarm();

    bool IsOpening();
    bool IsClosed();

    //获取***的显示文本
    QString GetCommStateText();

    void InitToInvalid();
    void InitToZero();
    void InitToValue(quint16 uvalue, float fvalue);

public:
    quint16 m_uCommState;           //601 通讯状态 0--正常,1-故障
    quint16 m_uRev[99];
    float m_fRev[100];

    //转发的100个UINT16数据
    quint16 m_uRunState;            //602 运行状态 0运行,1停止
    quint16 m_uFaultState;          //603 故障状态 0正常,1故障
    quint16 m_uAlarmState;          //604 告警状态 0正常,1告警
    quint16 m_uSwitchState;         //605 开关机状态 0已开机,1已关机
    quint16 m_uBacklightTimes;      //背光时长

    quint16 m_uSensorState;         //继电器状态
    quint16 m_uSystemUnit;          //系统单位

    quint16 m_uData[93];            //606~800 转发的UINT16数据:预留,数组数量=100-上面的转发数

    //转发的100个FLOAT数据
    float m_fInsideTemp;            //801 室内温度℃
    float m_fInsideHumi;            //803 室内湿度%
    float m_fAdjustTemp;            //温度校准值
    float m_fAdjustHumi;            //湿度校准值
    float m_fTempUpLimit;           //温度上限

    float m_fTempDownLimit;         //温度下限
    float m_fHumiUpLimit;           //湿度上限
    float m_fHumiDownLimit;         //湿度下限
    float m_fTempDiff;              //温度回差
    float m_fHumiDiff;              //湿度回差

    float m_fInsideTemp1;            //室内温度1,单位为℃
    float m_fInsideTemp2;            //室内温度2,单位为℃
    float m_fInsideTemp3;            //室内温度3,单位为℃
    float m_fInsideTemp4;            //室内温度4,单位为℃
    float m_fInsideTemp5;            //室内温度5,单位为℃

    float m_fInsideHumi1;            //室内湿度1,单位为%
    float m_fInsideHumi2;            //室内湿度2,单位为%
    float m_fInsideHumi3;            //室内湿度3,单位为%
    float m_fInsideHumi4;            //室内湿度4,单位为%
    float m_fInsideHumi5;            //室内湿度5,单位为%

    float m_fTempPay;               //温度补偿
    float m_fHumiPay;               //湿度补偿
    float m_fCo2Pay;                //CO2补偿

    float m_fData[77];              //805~1199 转发的FLOAT数据:预留,数组数量=100-上面的转发数

    // 601      800     200	UINT16	200	读温湿度的UNIT16数据	0x03/0x04	无	温湿度数据
    // 801      1200	400	FLOAT	200	读温湿度的FLOAT数据	0x03/0x04	无
    // 20201    20400	200	UINT16	200	写温湿度的数据	0x03/0x04	0x06

    //20201~20400 设置的数据:预留,数组数量=100-上面的设置数
    float m_fSetAdjustTemp;            //设置温度校准值
    float m_fSetAdjustTempCopy;
    float m_fSetAdjustHumi;            //设置湿度校准值
    float m_fSetAdjustHumiCopy;
    float m_fSetTempUpLimit;           //温度上限
    float m_fSetTempUpLimitCopy;
    float m_fSetTempDownLimit;         //温度下限
    float m_fSetTempDownLimitCopy;
    float m_fSetHumiUpLimit;           //湿度上限
    float m_fSetHumiUpLimitCopy;

    float m_fSetHumiDownLimit;         //湿度下限
    float m_fSetHumiDownLimitCopy;
    float m_fSetTempDiff;              //温度回差
    float m_fSetTempDiffCopy;
    float m_fSetHumiDiff;              //湿度回差
    float m_fSetHumiDiffCopy;
    float m_fSetTempPay;               //温度补偿
    float m_fSetTempPayCopy;
    float m_fSetHumiPay;               //湿度补偿
    float m_fSetHumiPayCopy;

    float m_fSetCo2Pay;                //CO2补偿
    float m_fSetCo2PayCopy;

    float m_fSetData[89];
    float m_fSetDataCopy[89];
    //上面100个浮点设置值
    //下面100个整形设置值
    quint16 m_uSetBacklightTimes;      //设置背光时长
    quint16 m_uSetBacklightTimesCopy;
    quint16 m_uSetSensorState;         //设置继电器状态
    quint16 m_uSetSensorStateCopy;
    quint16 m_uSetSystemUnit;          //设置系统单位
    quint16 m_uSetSystemUnitCopy;

    quint16 m_uSetData[97];
    quint16 m_uSetDataCopy[97];
};

#endif //TH_DATA_H
